addpath('../functions')
%% married 
run("MatlabDataConstruction_married.m")
load '../data/DataforMatlab/UK_Budget_married.mat'
load '../data/DataforMatlab/pvec_tmp.mat'
load ../data/DataforMatlab/IP.csv
load ../data/DataforMatlab/torn.csv

B_vec = B_vec./sum(B_vec);
I = size(B_vec,1);N = size(B_vec,2);T = size(B_vec,3);
pvec = reshape(pvec_tmp',[I,1,T]);
[U_vec] = CalMoneyMetric(I_vec, B_vec, pvec,0);
run("sub_make_percentile.m")
EVdivisia_m = RC;
OurxaxisUK_m = OurxaxisUK;
OuryaxisUK_m = OuryaxisUK;
save('../data/DataforMatlab/married_percentiles','EVdivisia_m','OurxaxisUK_m',"OuryaxisUK_m")
%% unmarried 
run("MatlabDataConstruction_unmarried.m")
load '../data/DataforMatlab/UK_Budget_unmarried.mat'
load '../data/DataforMatlab/pvec_tmp.mat'
load ../data/DataforMatlab/IP.csv
load ../data/DataforMatlab/torn.csv

B_vec = B_vec./sum(B_vec);
I = size(B_vec,1);N = size(B_vec,2);T = size(B_vec,3);
pvec = reshape(pvec_tmp',[I,1,T]);
[U_vec] = CalMoneyMetric(I_vec, B_vec, pvec,0);
run("sub_make_percentile.m")
EVdivisia_um = RC;
OurxaxisUK_um = OurxaxisUK;
OuryaxisUK_um = OuryaxisUK;
save('../data/DataforMatlab/unmarried_percentiles','EVdivisia_um','OurxaxisUK_um',"OuryaxisUK_um")

%%
load ../data/DataforMatlab/married_percentiles
load ../data/DataforMatlab/unmarried_percentiles